# -*- coding: utf-8 -*-
"""
@Time ： 2021/4/22 22:50
@Auth ： Mr. royalday 2487625775
@Company ： 2487625775@qq.cpm
@Function ：BootStrap基础样式类，用于其他类继承样式
"""


class BootStrapForm:
    bootstrap_class_exclude = []

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        # 设置字段排序
        # ordering = ['email', 'username', 'password', 'confirm_password', 'mobile_phone', 'code']
        # self.order_fields(ordering)

        # 设置每个字段的样式和文本框的默认值
        for name, field in self.fields.items():
            if name in self.bootstrap_class_exclude:
                continue
            field.widget.attrs['class'] = 'form-control'
            field.widget.attrs['placeholder'] = f"请输入{field.label}"
